<?php
namespace app\common\validate;

use think\Validate;

class PerUrl extends Validate
{
    protected $rule =   [
        'public_url_id'  => 'require',
        'id'  => 'require',
        'typeid'=>'require',
        'nickname'=>'require',
        'desc'=>'require',
        'key_word'=>'require',
        'title_id'=>'require',
        'u'=>'require',
        'token'=>'require|min:30',
        'color'=>'max:10'
    ];

    protected $message  =   [
        'id.require'     => 'id必须填写!',
        'typeid.require'     => '类型id必须填写!',
        'title_id.require'     => '标题id必须填写!',
        'u.require' => '验证码不能为空！',
        'public_url_id.require'     => '公共url_id必须填写!',
        'token.require' => 'token不能为空！',
        'token' => 'token格式错误！',
    ];

    /**
     * @var array 验证的场景
     */
    protected $scene = [
        'perAddByPId'  =>  ['typeid','public_url_id','nickname','desc','key_word'],
        'perAddByU'  =>  ['typeid','u','nickname','desc','key_word'],
        'checkTitleId'  =>  ['title_id'],
        'updatePerUrl'=>['typeid','id','nickname','desc','key_word','color'],
        'updatePerUrlTitle'=>['id','nickname'],
        'movePerUrl'=>['id','typeid'],
    ];
}
